package com.cdtye.itps.cms.dao.detect;

import com.baomidou.mybatisplus.annotation.*;
import com.cdtye.itps.cms.dao.defect.entity.JcwProblemDefectOrigin;
import com.cdtye.itps.cms.dao.enums.DelFlagEnum;
import com.google.gson.Gson;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

/**
 * @ClassName JcjcDefectSourceTypeSection
 * @Description TODO
 * @Author wang lei
 * @Date 2021/10/10 11:22
 * @Version 1.0
 **/
@TableName("JCW_DEFECT_SOURCE_TYPE")
@Data
@ApiModel("接触网缺陷来源")
public class JcjcDefectSourceTypeSection {

    private static final long serialVersionUID = 1L;

    @TableId(value = "SOURCE_TYPE_ID", type = IdType.ASSIGN_UUID)
    private String sourceTypeId;

    /**
     * 缺陷来源名称
     */
    @TableField("SOURCE_TYPE_NAME")
    private String sourceTypeName;

    /**
     * 缺陷来源编号
     */
    @TableField("ORIGIN_CODE")
    private String originCode;

    /**
     * 缺陷来源级联码
     */
    @TableField("CASCADE_CODE")
    private String cascadeCode;

    /**
     * 父级id
     */
    @TableField("PARENT_ID")
    private String parentId;


    /**
     * 描述
     */
    @TableField("REMARK")
    private String remark;

    /**
     * 排序号
     */
    @TableField("SORT_NUM")
    private String sortNum;



    @ApiModelProperty("创建时间")
    @TableField(value ="CREATE_DATETIME", fill = FieldFill.INSERT)
    private Date createDatetime;

    @ApiModelProperty("更新时间")
    @TableField(value ="UPDATE_DATETIME",fill = FieldFill.INSERT_UPDATE)
    private Date updateDatetime;

    @ApiModelProperty("删除标志，Y=是，N=否")
    @TableField(value ="DEL_FLAG", fill = FieldFill.INSERT)
    private String delFlag;

    @ApiModelProperty("创建人")
    @TableField(value ="CREATE_BY", fill = FieldFill.INSERT)
    private String createBy;

    @ApiModelProperty("更新人")
    @TableField(value ="UPDATE_BY",fill = FieldFill.INSERT_UPDATE)
    private String updateBy;


    @ApiModelProperty("实体名称")
    @TableField("MODEL_NAME")
    private String modelName;

    /**
     * 实体主键名称
     */
    @TableField("PK_NAME")
    private String pkName;

    /**
     * 关联页面
     */
    @TableField("MODEL_PAGE")
    private String modelPage;

    public JcwProblemDefectOrigin covEntity() {
        Gson gs = new Gson();
        String listStr = gs.toJson(this);
        JcwProblemDefectOrigin jcwProblemDefectOriginBrueau = gs.fromJson(listStr, JcwProblemDefectOrigin.class);
        jcwProblemDefectOriginBrueau.setOriginName(this.sourceTypeName);
        jcwProblemDefectOriginBrueau.setOriginCode(this.getOriginCode());
        jcwProblemDefectOriginBrueau.setUpdateDatetime(new Date());
        jcwProblemDefectOriginBrueau.setCreateDatetime(new Date());
        jcwProblemDefectOriginBrueau.setId(null);
        return jcwProblemDefectOriginBrueau;
    }
}
